package com.example.springbook.dao;

import com.example.springbook.bean.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserDao {

    @Insert("insert into user(id,username,address,tel,password) values (#{id},#{username},#{address},#{tel},#{password})")
    void addUser(User user);

    @Update("update user set username=#{username},address=#{address},tel=#{tel},password=#{password} where id=#{id}")
    void updateUser(User user);

    @Delete("delete from user where id=#{id}")
    void deleteUser(int id);

    @Select("select * from user")
    List<User> findAllUser();

    @Select("select password from user where id=#{id}")
    String selectUser(int id);

    @Select("select username from user where id=#{id}")
    String findUserName(int id);

}
